<template>
	<sc-water-mark ref="wm" :text="waterMarkContent" :subtext="waterMarkSubtext" :showWater="waterMark=='1'">
		<el-main class="nopadding">
			<div id="mypdf"></div>
		</el-main>
	</sc-water-mark>
</template>

<script>
import PDFObject from 'pdfobject'
import config from "@/config";
export default {
	data() {
		return {
			extName:this.$route.query.extName,
			attachId:this.$route.query.attachId,
			netDiskId:this.$route.query.netDiskId,
			isNetDisk:this.$route.query.isNetDisk,
			waterMarkContent:'',
			waterMarkSubtext:'',
			waterMark:'0',
		}
	},
	mounted() {
		this.waterMark = this.$TOOL.data.get("WATER_MARK");
		this.waterMarkContent = this.$TOOL.data.get("WATER_MARK_CONTENT");
		this.waterMarkSubtext = this.$TOOL.data.get("WATER_MARK_SUBTEXT");
		if(this.isNetDisk=='true')
		{
			let url = config.API_URL+'/get/file/readPdfOnLine?netDiskId=' + this.netDiskId + "&fileName=" + encodeURIComponent(this.attachId);
			PDFObject.embed(url, "#mypdf");
		}else {
			let url = config.API_URL+'/get/file/readPdfOnLine?attachId=' + this.attachId;
			PDFObject.embed(url, "#mypdf");
		}
	}
}
</script>

<style scoped>
.pdfobject-container {
	height: 100%;
}
</style>
